package common.util;

import common.config.exception.CustomException;
import common.model.enums.UserDeletedEnum;
import common.model.enums.UserValidEnum;
import common.model.po.SysUser;

/**
 * 描述
 *
 * @author 米泽鹏
 * @since 2023-12-1 下午 12:10
 */
public class UserChecker {

	public static void checkUser(SysUser user) {
		if (user == null || UserDeletedEnum.DELETED.getValue().equals(user.getIsDeleted()) || UserDeletedEnum.PRE_DELETED.getValue().equals(user.getIsDeleted())) {
			throw new CustomException("用户信息无效");
		} else if (UserValidEnum.INVALID.getValue().equals(user.getValid())) {
			throw new CustomException("用户已被禁用");
		}
	}

}
